package com.example.administrator.uis.view.paint

import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View

/**
 * Created by zhiweijin on 17-11-13.
 */
class Practice01LinearGradientView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {

    var paint=Paint(Paint.ANTI_ALIAS_FLAG)
    var shader =LinearGradient(0f,0f,500f,500f, Color.RED,Color.GREEN, Shader.TileMode.CLAMP)
    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        paint.shader = shader
        canvas?.drawCircle(250f,250f,250f,paint)
    }
}